/**
 * 
 */
package org.x.starter4j.jetty.proxyservlet;

import org.eclipse.jetty.proxy.ProxyServlet;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;

/**
 * @author huangyang@p-an.com 2013年11月11日
 */
public class DemoProxyServletServer
{
	public static void main(final String[] args) throws Exception
	{
		Server server = new Server(8080);

		ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
		context.setContextPath("/");
		server.setHandler(context);

		// 从http://localhost:8080/hello
		ProxyServlet.Transparent servlet = new ProxyServlet.Transparent("http://icbchost:8080/", "http://localhost:8080/");
		context.addServlet(new ServletHolder(servlet), "/hello");
		server.start();
		server.join();
	}
}
